Partially working swift. Prepare to merge with upstream. Take 2