Removed unused variables and altered comments