Refactor CoreFoundation objects so that they derive from a common base class