Tidy up codebase