moved confirmation code into its own method