Use a simple state function to handle ui views

- using a simple UI state function and termboxState context variable
  simplfy the state management of the UI
- decorate the UI drawing code to clear and flush the termbox buffers
- add a simple console log output on the last line of the console