Finally got everything working, thanks again Jake Love for having the same logic as I did, but actual working code that does what I was trying to do.