Fix unused variable
Big rewrite/reorganisation, R_OPTIM1 is still badly buggy
Fix R_OPTIM1