Implemented the code for Project 6.