problem 2, now with comments