It would be helpful to migrate this to Swift 3.0. I'm trying on my fork, but I don't know all the implementation details.