Add several clarifying comments to main.cpp. Shift code around to be more readable. Remove unneeded code.