improved string special character escape code, added comments
removed dependency on util module
removed unused code