Updated Models in r script and markdown file, and refractoring