Added code for prog assignment 2