refactored away some JSHint warnings