Removing useless duplicate operations