Final version of programming assignment 2