use OO style javascript
refactor: look more like a callback