An alternative implementation.

This was fun.