Message ids

Tried to fix the cid: problem + provide safer id generation
shouldn't this be private instead ?