Initial commit of rewrite in Swift.