more refactoring to make customization easier