Minor changes.
Added tests.