Mac OS X main code