Rewrite from scratch.

Don't expect a spectacular engine in the coming weeks, this is going to
take time.