Added Event-class
Some changes in structure of the code