Reworked the get_categories_hash method