retrieveCategories split into 2 functions to allow non-removal