Ok, this code works fine, but try more functional-style code. Something like this:
```
val aliasMap = accountSettings.collect{case AccountSettings(name, Some(alias)) => alias -> name}.toMap
```