Remove use of deprecated has_key and strip some whitespace