improve prune() heuristic. the search speed was increased. mem leaks fixed