refactoring and some fixes
release 0.9.1