Handle a bunch more clang warnings
Move settings lib into the main code, fixing error logging in it.