refactor unique method