working for file method, tests fixed