Coding fixes, thanks to @Ajnasz and JSLint :)