used utility function to filter array