Update for new architecture

trim out unused imports
Make the module documentation a bit nicer
Define main' and properly import types
Get rid of "open" and get this compiling
Update the core API and implementation