Streamlined plugin config loading code

Got rid of repeated stuff and centralised config saving and loading to 2
base functions.