issue #56 - some refactoring