make the incremental algorithm work