Do while

Just a tiny optimization here. Using a do-while allows us to eliminate some duplicate code.