Moved all pattern matching into xml so they can be localized.