Rewrite

Near-complete codebase rewrite. Also includes your Litreview PR for some reason - you might not have merged that?
Add to issue tracker and remove TODO.