Xero interview question

Refactor a poorly written project