#188 complete function of duplicate checking