Fixed JSHint suggestions

Fixed as many of the JSHint issues as possible.