Fixed some bugs and wrote the settings controller tests.