Adding constants and refactoring for more consistent use of constants.