Finished the code for sample