Updated according to the final version of the assignment.