Refactors diff.js