Rm duplicate code