remove heapq/collections/shutil to decrease memory usage