Reducing number of magic constants

Named constants and put them above the variables