Changed array filter to use query instead