Refactored to use strictly locals
Further refactoring

This should finish the work to make all globals to local variables.
That allows LuaJIT to properly compile things by interning the
references to the relevant parts (rather than looking up globals
all the time which stops a trace).
Merge remote-tracking branch 'upstream/master'

resolved conflicts with refactored structure
Make DEBUG a require()d local
Merge remote-tracking branch 'upstream/master'
fix several local calls of Math.round
Merge pull request #1 from chrox/master

fix several local calls of Math.round
Merge pull request #334 from hwhw/master

Refactoring: Make globals local