more function generation code