Moved most code out of Program.cs and into other classes. Added a debugging message output method in Program.cs.