Solution to problem 002