Cleanup
Reored conditions
Micro optimization for better register allocation