clean event functions (preparing jquery-free version) 2