Restore Format Document command, and fix merge issues