add Sam's validation context support

* this commit was originally in sams fork as ref 6baa444bae but has been
  rebased away