Added settings page and handled edge cases.