Xero interview question

Refactor this code? (zip file)