Use result from returned filter when traversing array