Improve code coverage

This PR goes on top of #322