Implemented the assignment 2