PE59 solution; sloppy, but correct