abstract id generation to it's own function