Rewriting array and path routines, mostly complete