refactoring sample device