before changing to do-while