simplify setting main function