refactored server and client actors