Time to tidy up the code