Bug fix: terminating
Replaced exit(0) with [NSApp terminate]
Implemented for iOS
Use lambda expressions instead of bind