little detail added to sample code