Fixed syntax error
Moved Cox extraction to after Rs correction and gain/offset correction