Refactor sample code.