fixed indent (expanded tabs to 4 spaces)

fixed exit condition checks