Added necessary code for Assignment 2 and appropriate commenting