Damn. I was doing something like this but commented it out yesterday during testing, and deleted it as commented code before i pushed. Adding it back in now with the suggested structure.