Fixed not reloading when settings changed bug

Also beautified code