Refactored code and put all constants in one place