Split struct event and related code into its own file.

#802