Separated function definition from event calls