add checks/tests for null or no patterns.