fixes some whitespacing, one-lines some extraneous if statements, format...

...s whitespaces to be vim-compliant :)

Sorry that this literally replaces everything, it wouldn't run for some reason from the command line due to 'whitespacing' errors or something like that
I couldn't figure out exactly what's going on here with the math, could you elaborate on this? I may be able to get it down to a modulus operator