Loading auto refresh state from localStorage and minor refactor.