Code for the first part of the project.