Dice - finished the code to update database