LCTHW: Exercise 30 Extra Credit (ugly solution)