write core.js