Removing unused constants and some minor refactoring.