I don't like including the if inside the returned function.  How about two different named function generators that can be called below instead of passing in a string?