Modify the creation of a handle function.

The extratype parameter is now very flexible. It accepts any KEY=VALUE pair.
KEYS are only allowed to be present once. Duplicates are filtered out automatically.
The first entry is used.