some progress with refactor