Initial support for ESC commands, and minor code formatting.