server processing refactor