Fix #15, cleanup server code.