Changed id generation and update