moves some constants into Constants class and makes a lot of parameters and local variables final.