refactor "id" generator implementation