Updated for latest Swift