Tidy up code and paths