Added Check for winning and tie. Added overwrite prevention

Overwrite prevention is quite different from yours..