changed numbers to constant variables and removed unnecessary code