added ability for flat and deep html structures