implement main program.