add a slice function.