move code into helpers.js that will be shared with dashboard
move telegraph.js to top level