refactor example.js