renamed main to old_main