merge similar if conditions