Assignment 3 code.