a ;ot of changes, made the preferences work and be persistent