Fixed problems which prevented JSHint from passing