Introduced better removal of whitespace

It now uses regular expressions (yeah, yeah, two problems...) but it's a lot shorter now.
Switching entirely to Unix line endings.