refactoring sample/test for a cleaner usage