Add safeName function