replace method by something more performant. Using splice and concat is shorter though