See the comments at the top of Terminal.cs for information.