Make a new Cocoa-friendly function and use it.
Get rid of the unused deprecated functions.
Merge branch 'master' into XCode4