some general js code moved to general.js