Add constructor,add subcategories and fix category detection