JavaScript syntax cleanup

Clean up problematic JavaScript based on JSHint