Basic server implementation, cleanup