Split main() into main() and realMain() for testing.