refactoring and smallification