In reply to durgesh01:
This looks too complex. Have you looked at my options in the package?
What are your requirements? provide an example with fixed variables.
Also, compare your desired implementation against a simpler one with constant changes.