Changed the slice function to be a little more logical