used splice instead of slice for readability