Refactored code in order to work with new version of js-poller module