algorithm for saving reconstructed geometry, doesnt fully work