attached incremental algorithm