cleanup server code