some refactoring to factorize duplicate code
try to fix dirty submodule