added sliceeq and reshape function. Fixed flatten function