Code Refactor. Moved js code to separate js file. Fixes rSKf3100eb6244d