[Task] put event logic into function