Ensure machine doc is inserted last after any related docs