Refactored issue #29; addressed issue #1 with R_HOME