automatically setting up events