Merge pull request #97 from ded/ugly-diff

big fat batch of changes
Merge remote-tracking branch 'upstream/master'