Coursera programming assignment 2