fixed sample_main to use new methods.