restructure for files and rebuilt file calls. Tested and works.