#114 some minor refactoring