refactoring code to fully support customizations