removed alerts and added missing semicolons in js file. Also added braces for conditionals