Split display code out of refresh function

Also changes to make AMO validator happy (setinterval uses function
wrapper, xhr uses async, global variables are pretty much guaranteed to
not conflict with other addons)