Corrected sample code