refactoring and hoisting constants