old server code moved to gen_server