RGIMS code as a diff from current trunk