Now the code has separate implementation and examination functions, uses smartlists sanely, and has relatively decent test coverage.