Rename nextId to lastId which is more accurate.