Added unit testing and merged

Merged with rprogramming branch