modified main.js with new diff technique