General patterns refactored.