Fix handling of upper/lowercase, and whitespace