Implement countRecords. CoreKitty internals improvements