Copy helper function