remove usage of Array.prototype.slice