allow saving history data to file

This tweaks polling and downloading a bit.
Seems to work ok.