v0.2 some refactoring