server now processes new connections in a separate function