Understanding my case insensitive list comparison