Added code for generating sopmi