refactored escaping