Rewrote the updater

Hopefully this will make it more reliable in the future. Fixes #906