Improved error reporting; R unit testing