refactoring to get up to standard