Tidy up repository structure
move code into .py files