Updated to handle {result: ...} wrapper