Major refactoring into version 0.2