complete refactor sample1