Message ids

Tried to fix the cid: problem + provide safer id generation