Implemented Part B of the project