Near the top of the code you started a do while loop.

do {

is there near the top, but when the block finally ends with

}

there is no while.