read user-supplied data, instead of reading from a file. And renaming the function