#206 refactoring and hotfix