refactor server comm