updated for proper widget type classes and added support for tag inserts.