swift utiity functions
refactored swift utility functions