Corrected filesystem so that it registers the end of the file.
Changed filesystem functions to make more sense
merged