rewrite of delta code