Reorg of R-scripts, working in DEMO template