Handler mechanism sample code