added logic to update values in the db