moved several functions to submodules