Which leads me to ask again whether my suggestions in your original comment address you question or if I'm missing something. I shouldn't need much more context, unless the issue is so incredibly specific to your particular code base that you'd really be better off getting someone to do code review. There is a codereview stackexchange site, which has
its own rules but it could turn out that you might be looking for that kind of resource instead (again, if you do go that route, please make sure to adhere to their guidelines before posting). —
jcalz 10 secs ago