Completed the functions of the assignment.