Start refactor of handling escape sequences.