some small refactoring still using termbox