Added slice function, along with a test main()