improve add method in file implementation