use range for slice p