refactor, tidy up