Tidy and refactor JavaScript
Improve winning alerts