Add function generation