revised main() in main_sample.cpp