Fixed the whole script, hope I'm done with that now