code revision for linear registration