Refactor tests
Guard against empty patterns
Test return omission