Sort styles before applying