Rework ndarray

This is a WIP, do not read it ;-)