this is the meat of the feature code.  requires testing at this point.