add main function
implement main function