numerous fixes, handled <class> tag