better server, but still has race conditions