Add callbacks for loop closures and other events and print a message