made it so the document change events would fire only once per change

fixed a bunch of style errors
Merge branch 'master' of https://github.com/bobboau/GateApp.git