Changed handling of optional AGI parameters. Updated examples and tests accordingly.