fixed problems with some variables not returning and filtering not working properly. that intersection method needed to sort the arrays first