cleaned up the code a bit
added explanation of the rules and annotated the regexps
removed \xA0 from being treated as regular whitespace (or should it?)