Improvements from as_submodule branch