main
events processing