Major refactoring. Split actor state and actor implementation.