refactoring, todos and tidying on multiple files