cleaning-up and mantis 3875. -- this is a tested working version, but
cleaning-up of this big mess is not finished.
correct the 'stopping message' option and comment
clean-up the code