Seperate file event creation into a function to prepare for more complex operations.