Added more doc strings, removed some unused variables.