Added unit tests
Refactored examples
Expanded comments