Better code for actor pattern