Improvements on general.js