removed superfluous ifs, a if not else b -> b if else a, nicer do while loop emulation

Removed two unnecessary ifs.
No need for if not when we can simply exchange " not " and ' '.
Infinite loop with if(condition): break seems like a nicer way to emulate do while loops.