refactoring sample.js