code normalize and make good api for ncurses