compact the learn.js logic