Remove Traces and duplicate lines