Moving function generation in to visitor.