Big refactor of submodules and dependencies