Format and other clean-up.
Added unit test.