Revert changes to shadow implementation from  bf04f5144fea36a0200ab811ee02b4646dfb4d37