Refactor sample