Added CocoaUtils class with convenient dispatch_sync() and dispatch_async() methods for running code on the main thread.