Moved client-side code into the script file.