Major refactoring into submodules. v0.2