fixed delete_matched to use array