Adding test to check for cache initialization
Refactoring to pass in the labels instead of using documents.labels