good and bad solution to problem 13