Added copyright hints.
Added tests.
Some small internal changes.
Merge remote-tracking branch 'origin/master'