code refactoring and creating constants.js