cleaning up, refactoring and reorganising, commenting