Began reallocating variables to local variables where applicable