The first thing you may recognize is that the program will make extensive use of global variables. There is a very good discussion on this subject at Stack Overflow. I'm not heading to promote or protect weighty use of worldwide variables right here, but I might stimulate you to know all perspectives on The subject and identify that there is a robu