Refactoring. Fix Array.prototype.splice