Updated sample to work properly