Updated JS Code

Made re-usable variables global.  Added function for reseting list.