Add type support into set().

Update argument order and make the set() easy to use. Also
fix multiple tables being appended to update when called multiple times.
Now it retains the last value.