tidy up refactor