working on functions code generation