Okay, this should fix it. Really need to refactor.