move engine to index.js