Replace hard coded nested definitions with compiled version - slower but easier to maintain