Added more tests and refined border conditions for slice.