refactor server methods