Extra join calls not needed.  Some variable renaming.
Remove temporary variables and just compare the sorted lists.