Settings bugfixes

Most of the diff just shows relocating a few lines to match the UI, so I placed comments on the important changes.