Thomson Reuters interview question

How would you clean up the code?