refactor sample.