Added support from curses.wrapper. Minor fixes