Moved file reading to a different function
Moved client side event formatting to a separate file for cleaner code