Moved YT API setup into a function.
Used a closure to avoid a global variable.
Cleaned-up source and added some comments.
Using .slice instead of .substring and removed a couple of variables that weren't needed
Removed unused table code from QR library.
Updated QR code library and switched to using <canvas> instead of <img>