Use const references for Settings methods

Also check for (this == &other) before locking mutexes.
Fix Settings locking
Split settings into seperate source and header files

This also cleans up settings a bit