on Coursera Programming Assignment 2