new version of the reconstruction algorithm