Move response parsing to separate function