loads of changes mainly to saving of settings using json