added code and sample