Factored out a lot of the logic involved with settings to a common file

Fixed some typos

Another typo