isEmpty is used instead of string manipulations