slightly cleaned-up R-scripts