Rewrite

Near-complete codebase rewrite. Also includes your Litreview PR for some reason - you might not have merged that?
Good job!