cleanup escape code parsing