Moved the reply out of loop in server request handler