used casecmp instead of downcase