Whitespace corrections (Windows LF -> Unix LF)

This commit doesn't change anything functionally, but corrects the mixture of Windows/Unix LF, also reformatting code according to typical standards.

Run `git diff -w` (ignore whitespace changes) to see the substantial changes only.