converted Array.prototype.diff to local function and cleaned up element refs