Programming assignment 2 - Solution