Rewrite script with ncurses