Small improvements on general.js