made sample code more proper