Added everyting to constants and optimized some code