Added example.js
Changed interface to reuse as much as possible.