refactory sample.