allow custom ID generation

Fixing #677