more robust parsing and response