But, seeing as you are attempting to deal with custom bag management, you might want to take a look at some of the others out there as they may have added secure frame management in their code.
One that sounds plausible ( I haven't checked the code ) is :
https://www.wowinterface.com/downloa...agsNivaya.html