clean event functions (preparing jquery-free version)