changed toArray to use allObjects and added ofType category method and tests.