updated R file with solution, first draft of comments