added support for categories and redefinition of the detection class