Fixes in scrips.js after Fredrik's review