In the process of writting a internal event loop and a state machine for the text processor