bug fixes and some work on a domDecode method