General code cleanup, commenting for settings page and relocated code