refactoring and tiddying up