Automatically init submodules and refactor a bit