Fixed a lot of code that was breaking and getting the wrong data. Less likely to break now.