Used single quotes in JavaScript and little more refactoring.