Refactor updateTuple()

The existing function was difficult to follow.  It worked when
adding a new tuple, but not in the most sensible manner.
Merge pull request #608 from splitbrain/updateTuple_refactor

Refactor updateTuple()