reduce server code