Do some small refactoring to improve the readability. Now also the corresponding tests.