up-dated Swift code