Refactoring in preparation of solving issue #44