Chomping algorithm, created main.js