Fix most exports and documentation issues. Move things around in a more correct and exportable way.