Added code for Problem #2