cleaned up parsing of responses