JS and SQL script changes