Moved code out of submodule