refactored the initializing ncurses code into its own function