Managing collection with complex ids

Preliminary attempt to work with complex ids in collections.
Ugly but it works