Implemented a large part of part3 of the project!