improves get_predecessors function