added some events handling