adjusting to ensure runs on other machines
more tweaks to r code to run