Better nextId generation