Eliminate duplicate code in Cmm pipeline