Code now compatible with current swift version

(It works)