#1 refactoring using constants and removing unused variables