added some small cosmetic changes to the file output and some more verbose error messages.