Created function to filter queue items