Don't add a newline at the end twice, don't join words that are separated with a newline.
Clean up the regexps
Merge pull request #1 from deshipu/master

Close, but no cigar.