Removed more unused variables and added some commenting.