removes some unused variables
adds missing semicolons