removed redundant variables and marked constants as final