Programming Assignment 2. It also contains two utility functions.