Final changes, minor variable name changes and removed unused variables.