Added support for Sub-Categories

I've added support for sub categories and also included changes from my previous pull request so that the dev branch will stay up to date. I will work on the dev branch from now on.