updates all the table values, code still needs improvement