modifying escape logic
Adjusted the escape logic back to the handler