Konrad's solution to problem 16