Added function code generation