used optional third parameter of range instead of awkward splice syntax