Revised real_main
Major clean-up in the includes