maybe we should setup  different conditions for small list and large list. I will try to look at some other implementations.