updating logic