Duplicate code removal