Added user events. Furhter refactoring.