Modified sample code