refactored code to use constants