Move getting master key and manifest into ensure_connected
Use 'pack' lines in manifest for packs (REPO FORMAT CHANGE)
Use an append function, and other cleanups