added a naive terminal IO layer