Added the Category and Type classes

Fixed an important bug causing incorrect behaviour and added two classes
: Category and Type