Altered query in get_ready_nodes in reverse order