improved mysql.js file