refactor actors, add tests: TODO fix bugs