Initial rewrite to swift.