refactor(id): externalize state