.all.any? to .all.empty?
reverting some changes to make the code clearer