Error calculation added to debug inconsistencies.