improved location / text output logic