Use strncasecmp instead of tolower+strncmp