function enhencement for latest requirement

Mid set as mark for grandfather, and then modify code correspondingly