Remove legacy and duplicate code.