issue #1 - various refactorings