Implemented event handlin