added slices
fixed for loop