Rather than repeatedly converting to lowercase, might be better to convert once, at the top.