optimise escape sequence handling