now accepts a file instead of a string