separate curses code into lib file