Updated code, fixed major loop bug, and added code comments