minor refactoring and json attribute added to Event class