added slice function