Remove unnecessary patterns