Cleanup, updated documentation and internals