Generating local functions as blocks