Fixed the problem, also removed a couple lines of code.