added support for shadow history maintenance, see the test case for an example