Made some changes to sample code