refactoring lib into submodules