optimize define method and add data-main to directing program entry

optimize define method and add data-main to directing program entry