Took care of an unchecked set operation and removed some unused variables