improve modularization of connect4 program