Move some debug info to main function