refactor id generator