-fixed a bug where one variable was not being passed to a function, just using global variable, and another so that you dont