Finished a working implementation of text mode.