changed the file to be a function