Refactor refresh

WARNING: untested on everything except emulator. Will test on Android (or try to do so), Kindle PW1 and Kobo Mini soon - if noone beats me to it.

Better not merge this yet!

Testing and fixes very welcome!