Sam Media interview question

I was asked to refactor some code.