tidy up problem 8