Rewritten using control events handling