[BUG #6169] code clean-up in variantoptimizer
[BUG #6169] minor comments and re-org