many fixes all around, the formatting code being the most invasive change
Merge pull request #77 from clovis/master

Update upstream