adding some duplicate check logic.