while loop for checking height