Sample code to use delegate