Updated with changes by Michael Baron:
Updated string comparisons from == "" to .isEmpty