This took longer than I thought. Now to run off and cry in a corner.