fixed some jshint warnings
indentation and minor readability improvements