Terminate unterminated statement in example
Declare variables only at the top of functions
Fix spelling
Merge pull request #19 from siebrand/2

Various fixes suggested by static code analysis