rafactor server code