did a lot of rearranging to get closer to acceptable marshaling