Remove unused jQuery script, also add checks for potentially empty values.