Changed how errors are reported so that the specific problem causing the files not to be properly synchronized or consistent is provided. Also cleaned up code for readability.