refactoring uniqDeep speed up