Migrated legacy code from ajslegacy.js to ajs