better pattern simplification