step function optimized and works. All conditionals out of main loop
step function optimized and works. All conditionals out of main loop. And first time with trailing white space removed upon saving