start of refactoring into separate modules with dispatcher