Cocoa utility classes by Adam Fox.