Added new methods for files and fixed some bugs.