Removed unused code; fixed bad variable case.