Cleanup and bug fix

Enumerations are updated to more recent formatting. Returned arrays are
proper NSArray type. InstanceOfClassForKey opens DB if not already open.