refactor ifs and use ActorPath instead of ActorRef