updated sample
modified some code