adding a full working example of code