Handed the wrong variable to a function. Fixed.