Remove iterations over dict.values(), change list for membership check to set