Solution by Simon Proctor
