Added code for sam