smart escaper code cleanup