Jinx

Improved the R logic and other minor changes.