Tests now pass at least.
First round done, now out for review.