removed debugging statements, fixed code