Smarter handling of submodules