Total refactoring for version 0.2