Code cleanup
- Update Swift code to conform to the latest compiler version
- Minor changes and fixes