Added constants and refactoring