Refactored and added tests for Event.ts