Cleaned up script.js a bit