Try it now. I realized I also left some debug code uncommented... whoops. I tested it out a bit more thoroughly and it seems to be working better now.