Cleaned up all secondary id generation

Applies to #90 as well