Refactor to server struct