Curses - terminal screen handling and optimization