a better solution for confirmation code

CC'ing #399