remove redundant phases