restructure code for saving user settings

 see #102