first operable version after refactoring