added function to get product categories and refactored the API call functionality into it's own function