refactored deprecated escape() method.