Cleaning up main and making AddPrint more extensible for other codes