Why are you multiplying the total number received by maxmssgs, again? Maybe I am not understanding what you are trying to do here.