Tailor compilation of serve function