Most of the work for #11

Still has a bug that prevents it from doing the complete round trip.