Small refactoring and bug fix

Fixed a refresh bug, also added the refresh interval to the settings
page.