Refactor and reformat borg_cheat_store()
* Delete loads of repeated code
* Get rid of six pointless static globals