inline while statements correctly