Refactor updateTuple()

The existing function was difficult to follow.  It worked when
adding a new tuple, but not in the most sensible manner.