better events handling