works with worklist algorithm