Worked on exercise logic and added comments