fixed some of the issues that these changes have created, also cleaned up some of the formating.
list of files is no longer being generated correctly, I suspet 'catfile' is being used incorectly.