refactoring and adding documentation for all of the event system