Final version of Program Assignment 2