First working prototype for the new format.

Still needs a lot of work however, error checking, recursive moving and
generally tightening up the code.