Really crappy tail recursion removal (for pairs only)