Refactorize module framework to be more solid with dependencies
PEP8 fixes