refactor sample2