Almost finished porting slice()