Added the once() and printListeners() methods, and additional sample code.