Ready for checking on R-dev
Cleaned up dependencies
Cleaned formatting of code