Updated the main game JavaScript, although I fear it needs a tidy up;)