server code cleanup

server code cleanup