More type safety in ID handling
Attempt trivial index mergeing and reference setting