Added processCategories function

This function creates a nested object containing the category
hierarchy.
Merge pull request #1 from ErnstHaagsman/categories_processcats

Added processCategories function