I think this is it. (pssh, do check for errors!)

Yep, done. (pssh, do check for errors!)
Merge pull request #1 from macrarazy/patch-1