Generate function body