Add input for text mode.

Needs refactoring, modified from a previous project.