refactored require_string check for input and kwquery