added nested category support and tests