wrap example code in main function.