small code improvements; added comments
fixed several warnings from jshin
further code improvements (jshint)