added check for whitespace in keys