optimize, saving spin lock time
open sort and uniq function