Reorganized for easier submodule integration