improved serve callback