settings code updated

and other code tweaks