impementing Transform matrix tracking to the extract code