changed all insert / archive queries to use optional matches