refactoring tidy up