way too much cut and paste here.  we need to abstract here and in xml.