Minor tweaks and better test coverage