Embed logic to index.ejs