restructured code

Restructured as .Rmd