Simplify main function behind legacy adapter