refactoring of the core.js