improved escape input helper