Updated the Test.R so that it works. Now need to incorporate this into the main document