Add exch() helper function