Clean up publish activity

Moved publishing to a background thread to make ui smoother.
Merge pull request #269 from elihart/publish

Clean up publish activity