Flatten redundant operations