Little fixes and added a doctest.