reduce duplication in js files.