Implemented the code for Project 5.