Added events code