Shouldn't have left these vars global.