fixed some JSLint warnings

fixed many JSLint warnings, mostly related to semi-colon placement, var declaration and so on
all test passing