Swift changes

Hmmm. I have a feeling I did this because I am expecting a lot more to happen here, but this will only be called from the one place so it could be an anonymous function.