completes array match function