Cleaned up html and js code, added some comments