mantis 3759 and code cleaning-up