fixed variable names and remove unnecessary code.