Fix some bugs, reimplemented persistence

Note to self/all, when refactoring all the code, the Android Manifest
tends to reset itself, thereby making you set all permissions again.