Fixed the SRDA data collection error, produced by incorrect handling of R environment file. Refactored this functionality into a function for potential re-use. Code cleanup.