Changes to file management

Changed to make several methods more simple.