Updated for latest version of Swift