Fixed an alert window typo.
Tidied up code. Hopefully haven't broken anything!