pulled out all bumf from the .R scripts