fixed winning problem and changed some variable names