finished most of the "update last value" section