Added win condition. fixed updating issues(caused by using setTimeout instead of ).