Major rewrite to transition from mongodb to a simple in-process db