Refactor for use as Submodule